- financial_year = FinancialYear.find_by(id: params[:current_financial_year])
- financial_year ||= FinancialYear.current
- main_financial_year_selector(financial_year)
- params[:period] = financial_year.started_on.to_s << '_' << financial_year.stopped_on.to_s
- params[:current_financial_year] ||= financial_year.id
- params[:accounts] = [Account.find_by(number: params[:account_number]).number]

#general-ledger
  - if params[:period]
    = main_toolbar do |t|
      = t.export :general_ledger,
                 item_label: :export_as_pdf.tl,
                 key: Printers::GeneralLedgerPrinter.build_key(financial_year: financial_year,
                                                               states: params[:states],
                                                               lettering_state: params[:lettering_state],
                                                               account_number: params[:account_number],
                                                               ledger: params[:ledger]) do |menu|
        - export_params = params.slice(:current_financial_year, :states, :account_number, :centralize, :lettering_state, :ledger, :level_1, :level_2, :level_3, :level_4, :level_5, :level_6, :level_7, :level_8, :level_9, :level_10)
        - menu.item :export_as_ods.tl, params: export_params.merge(format: :ods)
        - menu.item :export_as_csv.tl, params: export_params.merge(format: :csv)
        - menu.item :export_as_xcsv.tl, params: export_params.merge(format: :xcsv)

  = kujaku actions: false do |k|
    - k.helper :subledger_crit
    - k.hidden :current_financial_year
    - k.previous_navigation :previous_ledger, class: "btn btn-previous icn icn-before", params: params.slice(:current_financial_year, :ledger)
    - k.next_navigation :next_ledger, class: "btn btn-next icn icn-after", params: params.slice(:current_financial_year, :ledger)


  = main_list(:subledger_journal_entry_items)
  - content_for 'meta_toolbar'.to_sym do
    .active-list-actions
      = mask_lettered_items_button 'journal_entry_items-list'
      = mask_draft_items_button 'journal_entry_items-list'

  = footer_line do
    %table#subledger-journal-entry-items-totals
      %tbody
        %tr
          %td.totalscolumn= :account_totals.tl
          %td.smallcolumns= number_to_accountancy @calculations[0]
          %td.smallcolumns= number_to_accountancy @calculations[1]
          %td.smallcolumns= @calculations[2] >= 0 ? number_to_accountancy(@calculations[2]) : nil
          %td.smallcolumns= @calculations[2] < 0 ? number_to_accountancy(@calculations[2].abs) : nil
